Connecting to Excel and CSV Files in Power BI
Course: Microsoft Power BI Training
Topic: Connecting to Excel and CSV Files
Course Link: Microsoft Power BI Training at JustAcademy
Demo Link: Register for a Course Demo
JustAcademy Website: Visit JustAcademy
1. Introduction to Connecting Excel and CSV Files
Microsoft Power BI is a business intelligence and data visualization platform used to transform raw data into meaningful reports, dashboards, and analytical insights. Before creating visualizations, users must connect Power BI to a data source that contains the required information.
Excel workbooks and CSV files are two of the most commonly used data sources in Power BI. Organizations frequently use Excel to manage sales, expenses, inventory, customer details, employee information, and financial records. CSV files are often used to export data from business applications, databases, websites, and other information systems.
Power BI Desktop provides connectors that allow users to import these files, inspect their contents, clean the data using Power Query, and prepare it for reporting.
1.1 Why Connect Excel and CSV Files to Power BI?
- To analyze information stored in spreadsheets and exported files.
- To convert large tables into interactive charts and reports.
- To combine information from different departments.
- To clean inconsistent or incomplete records.
- To calculate business metrics such as total sales, profit, and growth.
- To identify trends, patterns, and unusual values.
- To reduce repetitive manual reporting tasks.
- To create reusable reporting workflows that can be refreshed when source data changes.
1.2 Example Business Scenario
A retail company maintains its sales transactions in an Excel workbook and receives monthly inventory exports in CSV format. The management team wants to analyze sales by product, compare regional performance, and understand inventory levels.
Power BI can connect to both files, prepare the information, and combine the relevant tables into a model for reporting. This allows the company to analyze different business activities in one reporting environment.
2. Learning Objectives
After completing this topic, learners should be able to:
- Understand Excel and CSV file formats.
- Identify when to use an Excel connector or a Text/CSV connector.
- Prepare files before importing them into Power BI.
- Connect Power BI Desktop to an Excel workbook.
- Connect Power BI Desktop to a CSV file.
- Understand the purpose of the Navigator window.
- Choose between Load and Transform Data.
- Configure delimiters, headers, and file encoding where necessary.
- Correct column data types in Power Query.
- Remove unwanted columns, rows, and duplicate records.
- Combine data from multiple files.
- Understand the difference between importing data and refreshing it.
- Troubleshoot common Excel and CSV connection problems.
3. Understanding Excel Files
Microsoft Excel is a spreadsheet application used to store, organize, calculate, and analyze information. Excel files can contain worksheets, tables, formulas, named ranges, and other supported workbook structures.
3.1 Common Excel File Extensions
| Extension |
Description |
Typical Use |
| .xlsx |
Standard Excel workbook format |
Business data and reports |
| .xlsm |
Excel workbook that can contain macros |
Workbooks using VBA macros |
| .xls |
Legacy Excel workbook format |
Older spreadsheet systems |
| .xlsb |
Excel binary workbook format |
Workbooks stored in binary format |
Support for specific formats depends on the connector, environment, and required components. Modern .xlsx files are generally a convenient choice for Power BI data preparation.
3.2 Components of an Excel Workbook
- Workbook: The complete Excel file.
- Worksheet: A sheet containing cells arranged in rows and columns.
- Excel Table: A structured range with named columns and built-in table behavior.
- Named Range: A named reference to a cell or range of cells.
- Header Row: The row containing column names.
- Formula: An expression used to calculate a value in Excel.
3.3 Why Excel Tables Are Recommended
When preparing data for Power BI, converting a simple data range into an Excel Table often makes the structure easier to identify and maintain.
Benefits include:
- Clear column names.
- A recognizable data structure.
- Automatic expansion when new rows are added to the table.
- More convenient selection of data objects in Navigator.
- Improved readability when multiple data tables exist in a workbook.
Example: Select the sales data in Excel, choose Insert > Table, confirm that the table has headers, and assign the table a meaningful name such as SalesData.
4. Preparing an Excel File Before Importing
Proper preparation reduces errors during data import and helps create a reliable Power BI model.
4.1 Use Clear Column Names
Each column should have a meaningful name that describes its contents.
Good examples: OrderID, OrderDate, ProductName, Region, Quantity, SalesAmount.
Avoid: Column1, Column2, Field3, or multiple columns with confusing or repeated headings.
4.2 Keep Data Consistent
Each column should generally contain one kind of information. For example, a SalesAmount column should contain numeric values rather than a mixture of numbers, text labels, and comments.
4.3 Avoid Merged Cells
Merged cells can make a table difficult to interpret because one value may appear to represent several rows or columns. Use a simple rectangular data structure instead.
4.4 Remove Unnecessary Blank Rows and Columns
Blank rows and columns may interfere with data detection or create unnecessary records. Remove them when they do not have a legitimate purpose.
4.5 Check Dates and Numbers
Dates should be recognizable as dates, and numeric fields should contain valid numeric values. Regional formats can affect interpretation. For example, 04/05/2026 can mean April 5 or May 4 depending on the date convention.
4.6 Recommended Excel Structure
| OrderID |
OrderDate |
Product |
Region |
Quantity |
SalesAmount |
| 1001 |
2026-01-05 |
Laptop |
West |
2 |
120000 |
| 1002 |
2026-01-12 |
Monitor |
North |
3 |
45000 |
| 1003 |
2026-02-03 |
Keyboard |
South |
5 |
10000 |
| 1004 |
2026-02-14 |
Laptop |
East |
1 |
60000 |
This structure is suitable for basic sales analysis because each row represents an order record and each column represents a particular attribute.
5. Connecting to an Excel Workbook in Power BI
Power BI Desktop provides an Excel workbook connector that lets users browse for an Excel file and select the relevant data objects.
5.1 Step-by-Step Connection Process
- Open Power BI Desktop.
- Open the Home tab on the ribbon.
- Select Get data.
- Choose Excel workbook from the available connectors.
- Browse to the location of the Excel file.
- Select the required workbook and click Open.
- Wait for the Navigator window to display the available worksheets, tables, or named ranges.
- Select the required data object.
- Review the preview to confirm that the correct data has been selected.
- Choose Load to load the data or Transform Data to prepare it first.
5.2 Understanding the Navigator Window
Navigator displays the data objects that Power BI can identify in the selected workbook. Depending on the workbook, these objects may include worksheets, Excel Tables, and named ranges.
Navigator helps users:
- Review the available data objects.
- Preview data before importing it.
- Select one or more required objects.
- Avoid importing unnecessary worksheets or tables.
5.3 Selecting Worksheets Versus Excel Tables
A worksheet may contain multiple data ranges, notes, totals, and formatting. An Excel Table provides a clearly defined rectangular data structure.
| Feature |
Worksheet |
Excel Table |
| Structure |
May contain multiple ranges and other content |
Defined rows and columns |
| Column names |
May require header promotion or cleanup |
Typically has explicit column headers |
| Data selection |
May include unnecessary worksheet content |
Usually identifies the intended data range clearly |
| Recommended use |
When the worksheet itself is the intended source |
When importing a structured data table |
Best practice: Prefer a well-structured Excel Table when the data represents a single logical dataset.
6. Load Versus Transform Data for Excel
After selecting data in Navigator, Power BI generally provides options to load the data directly or transform it before loading.
6.1 Load
The Load option imports the selected data using the current query configuration. It is suitable when the source is already clean and correctly structured.
Use Load when:
- The column names are correct.
- The data types are suitable.
- There are no significant unwanted rows or columns.
- The source is ready for modeling.
6.2 Transform Data
Transform Data opens Power Query Editor, where users can inspect and prepare the data before loading it into the model.
Use Transform Data when:
- Column names need correction.
- Dates or numbers are interpreted incorrectly.
- Blank rows or unwanted columns must be removed.
- Duplicate records need investigation.
- Several files must be combined.
- The source requires filtering, reshaping, or other cleaning steps.
6.3 Comparison
| Option |
Main Purpose |
Result |
| Load |
Import selected data directly |
Data becomes available in the Power BI model |
| Transform Data |
Prepare and clean the data |
Power Query Editor opens for additional processing |
7. Understanding CSV Files
CSV stands for Comma-Separated Values. It is a text-based file format used to store tabular information. A CSV file commonly stores one record per line, with fields separated by commas.
CSV files are frequently created by exporting data from databases, websites, CRM systems, accounting tools, inventory applications, and other business systems.
7.1 Example CSV Content
OrderID,OrderDate,Product,Region,Quantity,SalesAmount
1001,2026-01-05,Laptop,West,2,120000
1002,2026-01-12,Monitor,North,3,45000
1003,2026-02-03,Keyboard,South,5,10000
1004,2026-02-14,Laptop,East,1,60000
The first line contains column headings, and the following lines contain the data records.
7.2 Characteristics of CSV Files
- They store data as plain text.
- They are generally easy to create and exchange between applications.
- They can be opened in text editors and spreadsheet applications.
- They do not inherently preserve Excel-style formatting, formulas, multiple worksheets, or workbook relationships.
- They may use different delimiters and text encodings.
- They require careful interpretation of dates, numbers, and special characters.
7.3 CSV Versus Excel
| Feature |
Excel Workbook |
CSV File |
| Typical extension |
.xlsx |
.csv |
| Multiple worksheets |
Supported |
Not supported within a single CSV file |
| Cell formatting |
Supported |
Not stored as spreadsheet formatting |
| Formulas |
Can be stored in workbook cells |
Stores text values rather than workbook formulas |
| Data structure |
May contain tables, ranges, and multiple worksheets |
Typically a single table-like structure |
| Typical purpose |
Spreadsheet work and structured data storage |
Data exchange and system exports |
8. Preparing a CSV File Before Importing
Although CSV files are simple, differences in delimiters, encoding, and regional formats can cause import problems.
8.1 Verify the Delimiter
A delimiter separates one field from another. A comma is common, but some files use semicolons, tabs, or other separators.
For example, comma-separated data looks like this:
Product,Region,SalesAmount
Laptop,West,120000
Monitor,North,45000
A semicolon-separated file may look like this:
Product;Region;SalesAmount
Laptop;West;120000
Monitor;North;45000
If Power BI selects the wrong delimiter, several fields may appear in a single column.
8.2 Check the Header Row
The first row often contains the column names. Confirm that Power BI correctly identifies the headers. If the file has no header row, do not promote the first data record into column names.
8.3 Check Text Encoding
Text encoding determines how characters are represented in the file. An incorrect encoding can cause accented characters, currency symbols, and other non-English characters to display incorrectly.
8.4 Check Quoted Values
CSV files may place text inside quotation marks, especially when a field contains a comma.
CustomerID,CustomerName,City
1,"Shah, Amit",Mumbai
2,"Patel, Neha",Pune
A suitable CSV parser can interpret the comma inside a quoted name as part of the field rather than as a separator between columns.
8.5 Check Date and Number Formats
Review date formats, decimal separators, and thousands separators before loading the file. Power Query allows users to select a suitable locale when interpreting certain data types.
9. Connecting to a CSV File in Power BI
9.1 Step-by-Step Connection Process
- Open Power BI Desktop.
- Select Home on the ribbon.
- Choose Get data.
- Select Text/CSV.
- Browse to the required CSV file.
- Select the file and click Open.
- Review the data preview.
- Check the delimiter, file origin, and data interpretation settings when available.
- Choose Load if the data is ready or Transform Data if it needs preparation.
- Verify the imported table in the Power BI data model.
9.2 Understanding the CSV Preview Window
The preview helps you inspect how Power BI interprets the file before loading it.
Review these items:
- Whether fields are split into the correct columns.
- Whether the first row is recognized as headers.
- Whether characters display correctly.
- Whether dates and numeric values appear reasonable.
- Whether blank or malformed records are present.
9.3 What Happens After Loading?
When the CSV data is loaded, Power BI creates a table in the semantic model. You can then use the fields in report visuals, create measures, define relationships, and perform further analysis.
10. Working with Delimiters in CSV Files
A delimiter is the character or symbol used to separate fields in a text file. Choosing the correct delimiter is essential for accurate column detection.
10.1 Common Delimiters
| Delimiter |
Name |
Example |
| , |
Comma |
Product,Region,Sales |
| ; |
Semicolon |
Product;Region;Sales |
| Tab |
Tab-separated |
Product [Tab] Region [Tab] Sales |
| | |
Pipe |
Product|Region|Sales |
10.2 Example of a Delimiter Problem
Suppose a file contains:
Product;Region;SalesAmount
Laptop;West;120000
Monitor;North;45000
If Power BI treats the comma as the delimiter, the entire row may remain in one column because the file uses semicolons.
Solution: Choose the correct delimiter in the preview or adjust the source file to use a consistent format.
11. Working with Headers and Column Names
Column headers help users understand the meaning of the data. Power BI may detect headers automatically, but the result should always be checked.
11.1 Promote Headers
If the first row contains column names but Power Query treats it as ordinary data, use the Use First Row as Headers option in Power Query Editor.
11.2 Rename Columns
Use clear, descriptive names that are easy to understand in reports and calculations.
Examples:
- Column1 → OrderID
- Column2 → OrderDate
- Column3 → ProductName
- Column4 → SalesAmount
11.3 When the File Has No Headers
If the CSV contains only data rows, do not promote the first row as headers. Instead, assign appropriate column names after import.
12. Data Types in Excel and CSV Imports
Data types define how Power BI interprets values. Correct data types are important for calculations, sorting, filtering, relationships, and visualizations.
12.1 Common Data Types
| Data Type |
Example |
Typical Use |
| Text |
West, Laptop, Customer A |
Names and categories |
| Whole Number |
10, 250, 1001 |
Counts and integer identifiers |
| Decimal Number |
25.75, 99.95 |
Measurements and fractional values |
| Fixed Decimal Number |
125.50 |
Financial values requiring fixed decimal precision |
| Date |
2026-01-05 |
Calendar analysis |
| Date/Time |
2026-01-05 10:30 |
Timestamp analysis |
| True/False |
True, False |
Boolean flags |
12.2 Changing a Data Type in Power Query
- Open Power Query Editor using Transform Data.
- Select the column to modify.
- Open the data type menu in the ribbon or column header.
- Choose the appropriate type.
- Review any conversion errors.
- Correct invalid values or use suitable conversion rules.
- Select Close & Apply to apply the transformations.
12.3 Important Identifier Consideration
Identifiers such as CustomerID, ProductCode, and PostalCode may look numeric but are often better treated as text. For example, a postal code such as 01234 can lose its leading zero if imported as a number.
13. Introduction to Power Query Editor
Power Query Editor is the data preparation environment in Power BI. It lets users transform Excel and CSV data before loading it into the semantic model.
13.1 Main Uses
- Rename columns.
- Change data types.
- Remove unwanted rows and columns.
- Filter records.
- Replace values.
- Remove duplicates where appropriate.
- Split columns using delimiters.
- Merge or append queries.
- Combine multiple files.
- Handle errors and missing values.
13.2 Applied Steps
Power Query records many transformations as Applied Steps. When the query refreshes, Power Query evaluates the steps again against the source data, subject to the connector and configuration.
Example workflow:
- Connect to the Excel workbook or CSV file.
- Select the source data.
- Promote headers if necessary.
- Change data types.
- Remove unnecessary columns.
- Filter invalid records according to business rules.
- Load the prepared data.
13.3 Example M Code for a CSV File
Power Query uses the M language to define source connections and transformation steps. The following example demonstrates the general structure for reading a CSV file and assigning column types.
let
Source = Csv.Document(
File.Contents("C:\PowerBI\Sales.csv"),
[
Delimiter = ",",
Encoding = 65001,
QuoteStyle = QuoteStyle.Csv
]
),
PromotedHeaders = Table.PromoteHeaders(
Source,
[PromoteAllScalars = true]
),
ChangedTypes = Table.TransformColumnTypes(
PromotedHeaders,
{
{"OrderID", Int64.Type},
{"OrderDate", type date},
{"Product", type text},
{"Region", type text},
{"Quantity", Int64.Type},
{"SalesAmount", Currency.Type}
}
)
in
ChangedTypes
This is an illustrative example. The file path, delimiter, encoding, and column names must match the actual source. The path shown assumes that the file exists at that location on the computer running the query.
14. Cleaning Excel and CSV Data
Imported data may contain errors, inconsistent labels, blank values, or unnecessary fields. Cleaning the data improves its suitability for reporting.
14.1 Removing Unnecessary Columns
Remove fields that are not required for the reporting objective, provided they are not needed for relationships, calculations, or future analysis.
Example: If the report only analyzes product sales by region, an unused internal comment field may not need to be included.
14.2 Removing Blank Rows
Blank rows can be removed when they do not represent meaningful business records. Always inspect the source to avoid deleting legitimate records with intentionally blank fields.
14.3 Handling Duplicate Records
Duplicate records can inflate totals and produce incorrect analysis. However, repeated values do not automatically mean that a record is duplicated. Two separate orders may have the same customer, product, and amount.
Before removing duplicates, identify the fields that define a unique record, such as a transaction ID.
14.4 Replacing Incorrect Values
Use Replace Values in Power Query to standardize known variations, such as inconsistent category names.
Example:
| Original Value |
Standardized Value |
| North |
North |
| NORTH |
North |
| north |
North |
14.5 Handling Missing Values
Missing values should be investigated before they are removed or replaced. Depending on the business meaning, an appropriate approach may be to keep the blank, use a clearly defined unknown category, or correct the source data.
15. Combining Multiple Excel or CSV Files
Organizations often store data in separate files for each month, region, department, or business unit. Power BI can combine files when they have compatible structures.
15.1 Example Monthly Sales Files
A company stores three files:
- Sales_January.csv
- Sales_February.csv
- Sales_March.csv
Each file contains OrderID, OrderDate, Product, Region, and SalesAmount. The files can be combined into one table if their schemas are compatible.
15.2 Using the Folder Connector
- Place the relevant files in a dedicated folder.
- Make sure the files have consistent column names and compatible data types.
- Open Power BI Desktop.
- Select Get data and choose Folder.
- Browse to the folder containing the files.
- Review the list of files returned by the connector.
- Choose Combine and Transform Data or the equivalent available command.
- Review the sample file and confirm the data structure.
- Apply the required transformations.
- Load the combined data into Power BI.
15.3 Requirements for Combining Files
- Use a dedicated folder containing the intended files.
- Keep column names consistent wherever possible.
- Use compatible data types.
- Check that files contain the expected structure.
- Exclude unrelated files and temporary files.
- Review how missing or additional columns are handled.
15.4 Combine Versus Append
When working with files and queries, combining files commonly creates a consolidated table. In Power Query, Append queries specifically adds rows from one table to another, while Merge queries joins columns from related tables using matching fields.
16. Importing Data from Excel and CSV: Practical Comparison
| Task |
Excel Workbook |
CSV File |
| Connector |
Excel workbook |
Text/CSV |
| Typical data selection |
Choose a worksheet, table, or supported named range |
Inspect and parse the file as a table |
| Multiple data objects |
May contain multiple worksheets and tables |
Usually one table-like dataset per file |
| Delimiter selection |
Usually not required for worksheet tables |
Important for correctly separating fields |
| Header handling |
Depends on the selected worksheet or table |
Confirm whether the first row contains headers |
| Formatting |
Workbook can store formatting and formulas |
Plain-text values without spreadsheet formatting |
| Multiple-file workflow |
Folder or SharePoint Folder connector may be useful |
Folder connector can combine compatible CSV files |
17. Refreshing Excel and CSV Data
Refreshing data updates the imported information using the configured source connection and query steps. Refresh behavior depends on where the source file is stored, how Power BI accesses it, and how the report is published.
17.1 Refresh in Power BI Desktop
When an imported Excel or CSV source changes, users can refresh the report in Power BI Desktop to retrieve the latest available data and reapply the configured query steps.
Basic workflow:
- Update and save the source file.
- Open the relevant Power BI Desktop report.
- Confirm that the file path and source structure remain valid.
- Select Refresh.
- Review any errors or changes in the returned data.
- Validate important totals and visuals.
17.2 Refresh After Publishing
When a report is published to Power BI Service, refresh depends on the source location and connection configuration.
- Cloud-hosted files may be accessed through supported cloud connections.
- Files stored on a local computer may not be accessible to the service without an appropriate supported setup.
- Supported on-premises sources may require an on-premises data gateway.
- Credentials and permissions must be configured for the published semantic model.
- Scheduled refresh must be configured when required and supported.
17.3 Common Refresh Problems
- The source file has been moved or renamed.
- Column names or data structures have changed.
- Credentials have expired or been changed.
- The file is inaccessible to the refresh environment.
- A required gateway is unavailable or incorrectly configured.
- The source contains new values that cause data type conversion errors.
18. Common Excel Connection Errors and Solutions
18.1 File Not Found
Cause: The file path is incorrect or the workbook has been moved.
Solution: Verify the location, filename, file extension, and access permissions. Update the source path if necessary.
18.2 Workbook Structure Changed
Cause: A worksheet or table was renamed, removed, or redesigned after the query was created.
Solution: Open Power Query, inspect the navigation step, and update the query to reference the correct data object.
18.3 Incorrect Data Types
Cause: A column contains mixed values or uses a format that Power BI cannot interpret as expected.
Solution: Inspect the source values, use the appropriate type, and handle invalid records according to business rules.
18.4 Password-Protected or Encrypted Workbook
Cause: The connector or environment cannot access the protected workbook in its current form.
Solution: Check the connector's current limitations and organizational security requirements. Use an approved supported file or access method.
19. Common CSV Connection Errors and Solutions
19.1 All Data Appears in One Column
Cause: The delimiter does not match the actual file format.
Solution: Select the correct delimiter in the Text/CSV preview or adjust the file to use a consistent separator.
19.2 Incorrect Characters
Cause: The selected encoding does not match the file encoding.
Solution: Try the correct file origin or encoding option and verify that names and special characters display correctly.
19.3 Dates Are Incorrect
Cause: The file uses a different date convention or regional format.
Solution: Use an appropriate locale when converting the column to Date or Date/Time.
19.4 Numeric Values Are Treated as Text
Cause: Currency symbols, spaces, separators, or inconsistent values prevent correct type detection.
Solution: Clean the column, remove unwanted characters when appropriate, and assign a suitable numeric type.
19.5 Unexpected Rows or Missing Records
Cause: The file may contain blank lines, malformed rows, inconsistent quoting, or unintended filtering steps.
Solution: Review the source and query steps, then compare row counts with the expected source totals.
20. Best Practices for Connecting Excel and CSV Files
- Prepare a clean, rectangular data structure before importing.
- Use meaningful and consistent column names.
- Prefer Excel Tables for well-defined spreadsheet datasets.
- Check the CSV delimiter and encoding.
- Confirm whether the first row contains headers.
- Assign appropriate data types to all important columns.
- Treat identifiers with leading zeros as text when necessary.
- Use Transform Data when cleaning is required.
- Remove duplicates only after defining what makes a record unique.
- Combine files only when their structures are compatible.
- Keep source files in a stable, accessible location.
- Protect confidential data and use authorized access.
- Test refresh behavior after publishing.
- Document important transformations and source assumptions.
- Validate totals and row counts before using the report for decisions.
21. Practical Example: Connecting an Excel Sales File
Objective: Import a sales workbook, clean its data, and prepare it for reporting.
21.1 Sample Data
| OrderID |
OrderDate |
Product |
Region |
Quantity |
SalesAmount |
| 1001 |
2026-01-05 |
Laptop |
West |
2 |
120000 |
| 1002 |
2026-01-12 |
Monitor |
North |
3 |
45000 |
| 1003 |
2026-02-03 |
Keyboard |
South |
5 |
10000 |
| 1004 |
2026-02-14 |
Laptop |
East |
1 |
60000 |
21.2 Step 1: Create the Excel Table
Open the workbook, select the sales range, and convert it into an Excel Table. Name the table SalesData.
21.3 Step 2: Connect Power BI
In Power BI Desktop, select Home > Get data > Excel workbook. Browse to the workbook and select the SalesData table in Navigator.
21.4 Step 3: Transform the Data
Select Transform Data. Check the OrderDate, Quantity, and SalesAmount fields. Ensure that the date and numeric columns use appropriate data types.
21.5 Step 4: Load the Table
Select Close & Apply. Power BI loads the prepared table into the model.
21.6 Step 5: Create a Total Sales Measure
Total Sales = SUM(SalesData[SalesAmount])
This DAX measure calculates the total sales amount for the current filter context.
21.7 Step 6: Build a Visual
Create a bar chart with Region as the category and Total Sales as the value. Add a card visual to display total sales across the selected data.
21.8 Step 7: Validate the Results
Check the regional totals against the source data. Confirm that no records were unintentionally excluded and that the total matches the expected sum for the imported dataset.
22. Practical Example: Connecting a CSV Sales File
Objective: Import a CSV file containing sales records and ensure that its fields are interpreted correctly.
22.1 Sample CSV Data
OrderID,OrderDate,Product,Region,Quantity,SalesAmount
1001,2026-01-05,Laptop,West,2,120000
1002,2026-01-12,Monitor,North,3,45000
1003,2026-02-03,Keyboard,South,5,10000
1004,2026-02-14,Laptop,East,1,60000
22.2 Step 1: Save the File
Save the data as Sales.csv in a location accessible to Power BI Desktop.
22.3 Step 2: Connect to the File
Select Home > Get data > Text/CSV. Browse to Sales.csv and open the file.
22.4 Step 3: Inspect the Preview
Confirm that the data appears in six separate columns. Check that the first row is interpreted as headers and that the values are displayed correctly.
22.5 Step 4: Transform the Data
Select Transform Data. Verify the data types and correct any parsing issues. If the file uses a different delimiter or locale, adjust the relevant settings.
22.6 Step 5: Load and Analyze
Apply the transformations and create a Total Sales measure or another suitable calculation. Use the fields to build a basic regional sales report.
23. Practical Exercises
Exercise 1: Excel Connection
Create an Excel workbook with sales data. Connect it to Power BI and identify the available worksheets and tables in Navigator.
Exercise 2: CSV Connection
Create a CSV file with at least five records. Import it using the Text/CSV connector and inspect the preview.
Exercise 3: Data Type Correction
Import a file containing dates, quantities, prices, and product codes. Assign appropriate data types to each column.
Exercise 4: Data Cleaning
Add a few blank rows and inconsistent category names to a practice file. Use Power Query to clean the data and document the changes.
Exercise 5: Delimiter Troubleshooting
Import a semicolon-separated file. Observe what happens when the delimiter is set incorrectly, then correct the configuration.
Exercise 6: Combine Monthly Files
Create three CSV files with compatible sales columns. Use the Folder connector to combine them into one table.
Exercise 7: Refresh Testing
Change a value in the source file, refresh the Power BI report, and confirm whether the change appears as expected.
24. Mini Project: Sales Data Import and Preparation
Project Goal: Connect Power BI to Excel and CSV sales files and prepare the data for a simple sales analysis report.
24.1 Project Requirements
- Create or obtain one Excel sales workbook.
- Create or obtain one CSV sales file with compatible columns.
- Connect to both files using the appropriate connectors.
- Inspect the data using Navigator or the CSV preview.
- Clean column names and data types in Power Query.
- Handle blank or invalid records using documented rules.
- Combine the data when the business requirement and table structures support it.
- Create a Total Sales measure.
- Build a chart showing sales by region or product.
- Validate the results against the source files.
- Document the source paths and refresh requirements.
24.2 Expected Outcome
The completed project should demonstrate that the learner can connect to file-based data sources, prepare the data, load it into Power BI, and use it in a basic analytical report.
25. Interview Questions and Answers
Q1. What is the difference between an Excel file and a CSV file?
Answer: An Excel workbook can contain multiple worksheets, tables, formulas, and formatting. A CSV file is a plain-text format that usually stores a single table-like dataset with fields separated by delimiters.
Q2. How do you connect an Excel workbook to Power BI Desktop?
Answer: Select Home > Get data > Excel workbook, choose the file, select the required data object in Navigator, and choose Load or Transform Data.
Q3. How do you connect a CSV file to Power BI?
Answer: Select Home > Get data > Text/CSV, choose the file, inspect the preview and delimiter, then load or transform the data.
Q4. What is Navigator?
Answer: Navigator displays available data objects from a supported source and lets users select and preview the objects they want to import.
Q5. Why should Excel data be converted into a Table?
Answer: An Excel Table defines a clear data structure, uses explicit column names, and makes it easier to select the intended data in Power BI.
Q6. What is the purpose of Power Query?
Answer: Power Query connects to data and performs transformations such as changing data types, filtering rows, removing columns, and combining files before the data is loaded.
Q7. What is a delimiter in a CSV file?
Answer: A delimiter is the character that separates fields in the file, such as a comma, semicolon, or tab.
Q8. Why does all CSV data sometimes appear in one column?
Answer: The selected delimiter may not match the actual file format. Selecting the correct delimiter usually resolves this issue.
Q9. What is the difference between Load and Transform Data?
Answer: Load imports the selected data using the current query configuration. Transform Data opens Power Query Editor so users can clean and prepare the data before loading it.
Q10. Why are data types important?
Answer: Correct data types help Power BI perform calculations, date analysis, sorting, filtering, and aggregations correctly.
Q11. Can Power BI combine multiple CSV files?
Answer: Yes. The Folder connector can combine files with compatible structures into a consolidated table, subject to appropriate query configuration.
Q12. What is the difference between Merge and Append?
Answer: Merge joins columns from related tables using matching fields. Append adds rows from one table to another compatible table.
Q13. Why might a refresh fail after a file is moved?
Answer: The query may still reference the old file path. Update the source path and verify that the refresh environment can access the new location.
Q14. Should every duplicate record be removed?
Answer: No. First identify the fields that define a unique record. Similar-looking records may represent separate legitimate transactions.
Q15. What should be checked before publishing a report that uses Excel or CSV files?
Answer: Verify the source path, credentials, access permissions, refresh requirements, gateway needs where applicable, and the accuracy of the imported data.
26. Quick Revision Notes
- Excel and CSV files are common file-based Power BI data sources.
- Use the Excel workbook connector to connect to supported Excel files.
- Use Text/CSV to import CSV and supported text-delimited files.
- Navigator helps select worksheets, tables, and other supported workbook objects.
- Inspect the CSV preview before importing.
- Check the delimiter, headers, and encoding of CSV files.
- Use Transform Data when the source requires cleaning.
- Set appropriate data types for dates, numeric values, text, and identifiers.
- Power Query records repeatable transformation steps.
- The Folder connector can combine multiple compatible files.
- Refresh behavior depends on the source location and connection setup.
- Validate totals and records before building final reports.
27. Final Checklist
- Prepare the Excel workbook or CSV file.
- Confirm that column names and data structures are clear.
- Connect using the correct Power BI connector.
- Inspect the data preview and selected data objects.
- Check delimiters and headers for CSV files.
- Correct data types and locale-specific formats.
- Remove irrelevant data only when appropriate.
- Combine files only when the structures and business requirements support it.
- Load the prepared data into Power BI.
- Create a basic visual and verify the values.
- Test refresh and access requirements.
- Document any assumptions and transformations.
28. Official Learning Resources
29. Conclusion
Connecting Excel and CSV files is an essential skill for Power BI users. Excel provides a flexible workbook structure that can contain multiple worksheets and tables, while CSV provides a simple text-based format for exchanging tabular information between applications.
To connect these sources successfully, prepare the files, choose the correct connector, inspect the available data, verify headers and delimiters, and use Power Query to correct data types and clean the information. When working with multiple files, confirm that their structures are compatible before combining them.
Finally, validate the imported data and understand the refresh requirements before publishing a report. These skills provide a strong foundation for data modeling, DAX calculations, interactive visualizations, and business reporting in Power BI.
For structured training, visit the Microsoft Power BI Training course page at JustAcademy or register for a course demo.